package com.yixq.soa.service.web.dto;

import io.swagger.annotations.ApiModelProperty;

/**
 * 
* @ClassName: DoorduResult
* @Description: 用于返回 REST 结果的基类,请继承该类
* @author kyler.tang 
* @date 2016年11月16日 下午2:32:57
* 
* @param <T> data 的类型
 */
public abstract class DoorduResult<T> {
	
	public static final String DEFAULT_SUCCESS_CODE = "200";
	public static final String DEFAULT_SERVIER_ERROR_CODE = "500";

	//消息字符串
	@ApiModelProperty(value="消息文本",example="",required=true)
	private String message = null;
	
	//总记录数
	@ApiModelProperty(value="总记录数,仅作用在分页显示的列表返回中",example="0",required=true)
	private Long totalCount = null;
	
	//处理是否成功
	@ApiModelProperty(value="服务器是否成功处理,成功:true,失败:false",example="true",required=true)
	private Boolean success = null;
	
	@ApiModelProperty(value="结果码,非200均表示业务处理失败.",example=DEFAULT_SUCCESS_CODE,required=true)
	private Long code = Long.valueOf(DEFAULT_SUCCESS_CODE);
	
	@ApiModelProperty(value="返回的数据体",required=true)
	protected T data;
	
	public String getMessage() {
		return message;
	}
	public void setMessage(String message) {
		this.message = message;
	}
	public Long getTotalCount() {
		return totalCount;
	}
	public void setTotalCount(Long totalCount) {
		this.totalCount = totalCount;
	}
	public Boolean getSuccess() {
		return success;
	}
	public void setSuccess(Boolean success) {
		this.success = success;
	}
	
	public void setData(T data){
		this.data = data;
	}
	
	public Long getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = Long.valueOf(code);
	}
	public void setCode(Long code) {
		this.code = code;
	}
	
	public T getData(){
		return data;
	}
}
